package com.example.rabbitmqstudy.spring;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

@Component
public class CustomerListener {

    @RabbitListener(queues = "queue_name")
    public void receive(String message) {
        System.out.println(String.format("%s, receive: %s",
                LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), message));
    }

}
